"use strict";
const way = require("../utils/way");

/**
 * 发券
 * @param {*} cloud 
 * @param {*} openId 
 * @param {*} code 
 * @param {*} miniAppId 
 */
exports.send = async (cloud, openId, code, miniAppId) => {
  const unique_id = new Date().getTime();
  const data = {
    'right_ename': code,
    'receiver_id': openId,
    'user_type': 'taobao',
    'unique_id': unique_id,
    'app_name': "promotioncenter-" + miniAppId
  };
  return await way.taobao(cloud, "alibaba.benefit.send", data);
};